<template>
  <h2>App 父级组件</h2>
  <button @click="isShow = !isShow">切换显示</button>
  <hr />
  <child v-if="isShow" />
</template>
<script lang="ts">
import Child from "./components/Child.vue";
import { defineComponent, ref } from "vue";
export default defineComponent({
  /**
   * 与 2.x 版本生命周期相对应的组合式 API
      beforeCreate -> 使用 setup()
      created -> 使用 setup()
      beforeMount -> onBeforeMount
      mounted -> onMounted
      beforeUpdate -> onBeforeUpdate
      updated -> onUpdated
      beforeDestroy -> onBeforeUnmount
      destroyed -> onUnmounted
      errorCaptured -> onErrorCaptured
   */
  name: "App",
  components: {
    Child,
  },
  setup() {
    const isShow = ref(true);
    return {
      isShow,
    };
  },
});
</script>